// db.ts
import Dexie, { Table } from "dexie";

export interface Cart {
  id: number;
  [prototypeName: string]: any;
}

export class MySubClassedDexie extends Dexie {
  // 'friends' is added by dexie when declaring the stores()
  // We just tell the typing system this is the case
  cart!: Table<Cart>;

  constructor() {
    super("myDatabase");
    this.version(1).stores({
      cart: "++id" // Primary key and indexed props
    });
  }
}

export const db = new MySubClassedDexie();
